﻿//-----------------------------------------------------------------------
// <copyright file="Vertex.cs" company="Luboš Bretschnieder">
// Copyright (c) 2008 Luboš Bretschnieder, Licensed under the Apache License, Version 2.0.
// </copyright>
//-----------------------------------------------------------------------
namespace Graphs
{
    using System;

    /// <summary>
    /// Vertex implementation.
    /// </summary>
    public class Vertex : ICloneable
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Vertex"/> class.
        /// </summary>
        /// <param name="name">The vertex name.</param>
        public Vertex(string name)
        {
            this.Name = name;
            this.State = VertexState.Normal;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Vertex"/> class.
        /// </summary>
        /// <param name="name">The vertex name.</param>
        /// <param name="order">The vertex order.</param>
        /// <param name="minimum">The vertex score.</param>
        public Vertex(string name, int order, int minimum)
            : this(name)
        {
            this.Order = order;
            this.Minimum = minimum;
        }

        /// <summary>Gets or sets the name of the vertex.</summary>
        /// <value>The name of the vertex.</value>
        public string Name { get; set; }

        /// <summary>Gets or sets the order of the vertex.</summary>
        /// <value>The order of the vertex.</value>
        public int Order { get; set; }

        /// <summary>Gets or sets the minimum of the vertex.</summary>
        /// <value>The minimum of the vertex.</value>
        public int Minimum { get; set; }

        /// <summary>Gets or sets the X position of the vertex in the GUI.</summary>
        /// <value>The X position of the vertex in the GUI.</value>
        public double X { get; set; }

        /// <summary>Gets or sets the Y position of the vertex in the GUI.</summary>
        /// <value>The Y position of the vertex in the GUI.</value>
        public double Y { get; set; }

        /// <summary>
        /// Gets or sets the state of vertex.
        /// </summary>
        /// <value>The state of vertex.</value>
        public VertexState State { get; set; }

        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        object ICloneable.Clone()
        {
            return this.Clone();
        }

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>Cloned vertex.</returns>
        public virtual Vertex Clone()
        {
            return (Vertex)MemberwiseClone();
        }
    }
}